<template>
	<el-form :model="stewardform" label-width="80px">

		<el-form-item label="员工编号">
			<el-input v-model="stewardform.staffId"></el-input>
		</el-form-item>
		<el-form-item label="公寓编号">
			<el-input v-model="stewardform.houseId"></el-input>
		</el-form-item>
		<el-form-item label="楼层名称">
			<el-input v-model="stewardform.floorName"></el-input>
		</el-form-item>
		<el-form-item label="备注信息">
			<el-input v-model="stewardform.remarks"></el-input>
		</el-form-item>
		<el-form-item label="创建时间">
			<el-date-picker
			     v-model="stewardform.createtime"
			     type="datetime"
				 value-format="yyyy-MM-dd HH:mm:ss"
			     placeholder="选择日期">
			   </el-date-picker>
		</el-form-item>

		<el-button type="primary" @click="doStewarEdit">提交</el-button>
	</el-form>

</template>

<script>
	export default {
		name: 'StewardEdit',
		props: {
			formData: {
				type: Object,
				default: () => ({})
			},
			editVisible: {
				type: Boolean,
			}
		},
		data() {
			return {
				stewardform: {
					staffId: '',
					houseId: '',
					floorName: '',
					remarks: '',
					createtime: ''
				}
			}
		},
		mounted() {
			this.stewardform = this.formData;
			console.log("子组件数据:");
			console.log(this.stewardform)
		},
		methods: {
			doStewarEdit() {
				this.postRequest("/steward/update", this.stewardform).then(resp => {
					if (resp) {
						this.$emit("update:editVisible", false);
					} else {
						this.$message.error({
							message: '编辑失败'
						});
					}
				})
			}
		},
		watch: {
			formData: {
				deep: true,
				handler(newVal, oldVal) {
					this.planform = newVal
				}
			}
		}
	}
</script>

<style>
</style>
